<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%=tr8n_current_language.locale%>" lang="<%=tr8n_current_language.locale%>" <%=tr8n_dir_attribute_tag%>>
<head>
  <%= stylesheet_link_tag('tr8n/tr8n.css') %>
  <%= stylesheet_link_tag('tr8n/keyboard_1_49.css') %>
  <%= csrf_meta_tags %>

  <% if Tr8n::Config.enable_software_keyboard? %>
    <script> 
      VKI_default_layout = "<%=Tr8n::KeyboardMapping.current_1_49%>";
      VKI_default_keyboard_image = "/assets/tr8n/keyboard.png";
    </script>     
    <%=stylesheet_link_tag("tr8n/keyboard_1_49.css") -%>
  <% end %>  

  <%= javascript_include_tag('tr8n/tr8n.js') %>

  <% if Tr8n::Config.enable_google_suggestions? %>  
    <script type="text/javascript">
      Tr8n.google_api_key = "<%=Tr8n::Config.google_api_key %>";
    </script>
  <% end %>

  <script type="text/javascript">
    function resizeFrame() {
      Tr8n.postMessage({'subject': 'translator', 'action': 'resize', 'height': Tr8n.element('tr8n_translator_content').offsetHeight + 10}, '<%=params[:origin]%>');
    }

    function hideTranslator() {
      Tr8n.postMessage({'subject': 'translator', 'action': 'hide'}, '<%=params[:origin]%>');
    }

    function reloadOrigin() {
      Tr8n.postMessage({'subject': 'window', 'action': 'reload'}, '<%=params[:origin]%>');
    }

    Tr8n.Utils.addEvent(document, "keyup", function(event) {
      if (event.keyCode == 27) {
        hideTranslator();
      }
    });
  </script>
</head> 
<body style="padding:0px;margin:0px;" onload="resizeFrame()" <%=tr8n_dir_attribute_tag%>>
  <div id="tr8n_translator_content" class="tr8n_translator_content" <%=tr8n_dir_attribute_tag%> > 
    <%= tr8n_with_options_tag(:default_locale => Tr8n::Config.default_admin_locale, :admin => true) do %>
    <% unless @hide_header %>
      <div class="hd">
        <div class="supplemental" style="<%=tr8n_style_attribute_tag('float', 'right')%>;">
          <%=link_to_function(image_tag("tr8n/close.gif", :title=>trla("Close")), "hideTranslator()")%>
        </div>
        <%= tr8n_language_flag_tag(tr8n_current_language) %>
        <%= tra("{language} Translation", nil, :language => tr8n_current_language.native_name) %>
      </div>
    <% end %>
    
    <div id="tr8n_translator_container" class="bd">
      <%= yield %>
    </div>  
    <% end %>
  </div>
</body>
</html>
